package com.ymh.feign;

import com.ymh.common.domain.ResultData;
import com.ymh.domain.ProductDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author: 13590
 * @date: 2020/10/27 19:53
 * @description:
 */
@FeignClient("product-service")
public interface ProductFeign {
  @PostMapping("/insert")
  ResultData<String> insert(@RequestBody ProductDTO productDTO);

  @DeleteMapping("/delete")
  ResultData<String> delete(@RequestParam("productCode") String productCode);

  @PostMapping("/update")
  ResultData<String> update(@RequestBody ProductDTO productDTO);

  @GetMapping("/productCode/{productCode}")
  ResultData<ProductDTO> getByProductCode(@PathVariable(value = "productCode") String productCode);

  @GetMapping("/deduct")
  ResultData<String> deduct(@RequestParam("productCode") String productCode,
      @RequestParam("count") Integer count);
}
